From: Balló György Date: Fri, 17 Oct 2025 17:42:21 +0000 (+0200) Subject: loginDialog: Sort session list by name X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~44^2~171 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=b86fc53821169313dc6bfe9985902d5e84397010;p=gnome-shell.git loginDialog: Sort session list by name Instead of sorting the available sessions by their ID, sort them by their name. This ensures that the list is sorted based on the system locale. Part-of: --- diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index 26966b633..1b568cbde 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -385,17 +385,20 @@ const SessionMenuButton = GObject.registerClass({ _populate() { let ids = Gdm.get_session_ids(); - ids.sort(); if (ids.length <= 1) { this._button.hide(); return; } - for (let i = 0; i < ids.length; i++) { - let [sessionName, sessionDescription_] = Gdm.get_session_name_and_description(ids[i]); + const sessions = ids.map(id => { + const [sessionName] = Gdm.get_session_name_and_description(id); + return {id, sessionName}; + }); + + sessions.sort((a, b) => a.sessionName.localeCompare(b.sessionName)); - let id = ids[i]; + for (const {id, sessionName} of sessions) { let item = new PopupMenu.PopupMenuItem(sessionName); this._menu.addMenuItem(item); this._items.set(id, item);